# -*- coding: utf-8 -*-

"""StaffLog - Terminal
@version: 0.1
@license: GPL 3.0 (see "license" file)
@author: Jose A. Jimenez <jajimc@gmail.com>, Miguel Centeno <miguelcent@gmail.com>"""

import gtk
import gobject
import threading
from opencv.cv import *
from opencv.highgui import *
import images

class DialLogin:
    def __init__(self):
        self.gladeFile = "diallogin.glade"
        self.builder = gtk.Builder()
        self.builder.add_from_file(self.gladeFile)
        self.dialLogin = self.builder.get_object("dialLogin")
        self.entHost = self.builder.get_object("entHost")
        self.entPort = self.builder.get_object("entPort")
        self.entUserId = self.builder.get_object("entUserId")
        self.entUserPassword = self.builder.get_object("entUserPassword")
        
        self.entHost.set_text("localhost")
        self.entPort.set_text("8000")
        
        self.host = ""
        self.port = 0
        self.userId = ""
        self.userPassword = ""
        
    def run(self):
        self.dialLogin.show_all()
        result = self.dialLogin.run()
        self.host = self.entHost.get_text()
        
        try:    
            self.port = int(self.entPort.get_text())
        except:
            self.port = 0
            
        self.userId = self.entUserId.get_text()
        self.userPassword = self.entUserPassword.get_text()
        self.dialLogin.destroy()
        
        return result
